<!--
 * @Author: 王灿
 * @Date: 2019-10-27 00:40:05
 * @LastEditTime: 2019-11-26 22:05:06
 * @Description: 登录 --  注册
 * @FilePath: \scarlet-sparrow-admin\src\views\login\index
-->
<template>
  <div class="login">
    <!-- 登录 -->
    <login-form v-if="isLogin" @onChangeFlag="onChangeFlag" />
    <!-- 忘记密码 -->
    <forget-form v-if="isForget" @onChangeFlag="onChangeFlag" />
  </div>
</template>

<script>
import LoginForm from './login-form/index.vue'
import ForgetForm from './forget-form/index.vue'
export default {
  name: 'Login',
  components: { LoginForm, ForgetForm },
  data() {
    return {
      isLogin: true,
      isForget: false
    }
  },
  created() {
    document.title = this.isLogin ? '登录' : '忘记密码'
    
  },
  watch: {
    isLogin() {
      document.title = this.isLogin ? '登录' : '忘记密码'
    }
  },
  methods: {
    // 父子组件传值
    onChangeFlag(data) {
      this.isLogin = data.isLogin
      this.isForget = data.isForget
    }
  }
}
</script>

<style lang="scss" scoped>
.login {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: url('./../../assets/img/login-bg.jpg') no-repeat;
  background-size: 100% 100%;
}
</style>
